﻿using UnityEngine;

public class PropertyElementTile : PropertyElement {
	// === Public =====================================================================================================
	public PropertyElementTile(Vector2 pos, Texture texture) {
		UpdateProperties(pos, Tools.Resources.GetTexturePath(texture));
	}

	public PropertyElementTile(Vector3 pos, Texture texture) {
		UpdateProperties(pos, Tools.Resources.GetTexturePath(texture));
	}

	public PropertyElementTile(Vector2 pos, string texturePath = null) {
		UpdateProperties(pos, texturePath);
	}

	public PropertyElementTile(Vector3 pos, string texturePath = null) {
		UpdateProperties(pos, texturePath);
	}

	// === Private ====================================================================================================
	private void UpdateProperties(Vector2 pos, string texturePath) {
		UpdateProperties(new Vector3(pos.x, -0.5f, pos.y), texturePath);
	}

	private void UpdateProperties(Vector3 pos, string texturePath) {
		Type = ElementType.Tile;
		Name = "Tile";
		Position = pos;
		Rotation = Quaternion.Euler(new Vector3(90, 0, 0));
		Scale = Vector3.one;
		TexturePath = texturePath;
		Color = new Color(1, 1, 1, 1);
	}
}